App.order = App.cable.subscriptions.create "OrderChannel",
  received: (data) ->
    $('div#js-display-order-notification').css('display', 'block')
    $('div#js-display-friend-notification').append(
      "<audio src='/add_friend_notice.mp3' autoplay=''></audio>"
    );
    count = 0
    message = () ->
      count++
      if count%2==1
        document.title='【你有新的消息】'
      else
        document.title='【　　　　　　】'
    setInterval(message, 800)


App.friend = App.cable.subscriptions.create "FriendChannel",
  received: (data) ->
    $('div#js-display-friend-notification').css('display', 'block')
    $('div#js-display-friend-notification').append(
      "<audio src='/add_friend_notice.mp3' autoplay=''></audio>"
    );
